import 'dart:io';

void main() async {
  try {
    int res1 = await getFirst();
    print(res1);
    int res2 = await getSecond();
    print(res2);
    int res3 = await getThred();
    print(res3);
  } catch (e) {
    print(e);
  }
}

Future<int> getFirst() {
  return Future<int>(() {
    sleep(new Duration(seconds: 2));
    print('第一个项目运行成功');
    return 1;
  });
}

Future<int> getSecond() {
  return Future<int>(() {
    sleep(new Duration(seconds: 2));
    print('第二个项目运行成功');
    return 2;
  });
}

Future<int> getThred() {
  return Future<int>(() {
    sleep(new Duration(seconds: 2));
    throw new Exception('出错了');
    // print('第三个项目运行成功');
    // return 3;
  });
}
